/* Generates predicted hazards by sampling from the betas of the Weibull coup attempts model */

set more off

set mem 100m

use "c:\Data Sets\Africa\africa_1.dta", clear
stset coupcount, failure(atcoup) id(coupid)
bsample
streg miltogdp currenta  intrimgv subsh num_coal seatlar pmpty_s natun civ_war polity anarchy nxtpa_el us_aid sunus gdpgrowt populati lagpcgdp imfstatu WoverS Wgrow, dist(w) cluster(code) 
use "c:\Data Sets\Africa\africa_1.dta", clear
drop pcoup
predict pcoup, hazard
replace IMFpcoup = imfstatu*pcoup

save "c:\Data Sets\Africa\africa_1.dta", replace

use "c:\Data Sets\Africa\africa_2.dta", clear
stset coupcount, failure(atcoup) id(coupid)
bsample
streg miltogdp currenta  intrimgv subsh num_coal seatlar pmpty_s natun civ_war polity anarchy nxtpa_el us_aid sunus gdpgrowt populati lagpcgdp imfstatu WoverS Wgrow, dist(w) cluster(code) 
use "c:\Data Sets\Africa\africa_2.dta", clear
drop pcoup
predict pcoup, hazard
replace IMFpcoup = imfstatu*pcoup

save "c:\Data Sets\Africa\africa_2.dta", replace

use "c:\Data Sets\Africa\africa_3.dta", clear
stset coupcount, failure(atcoup) id(coupid)
bsample
streg miltogdp currenta  intrimgv subsh num_coal seatlar pmpty_s natun civ_war polity anarchy nxtpa_el us_aid sunus gdpgrowt populati lagpcgdp imfstatu WoverS Wgrow, dist(w) cluster(code) 
use "c:\Data Sets\Africa\africa_3.dta", clear
drop pcoup
predict pcoup, hazard
replace IMFpcoup = imfstatu*pcoup

save "c:\Data Sets\Africa\africa_3.dta", replace

use "c:\Data Sets\Africa\africa_4.dta", clear
stset coupcount, failure(atcoup) id(coupid)
bsample
streg miltogdp currenta  intrimgv subsh num_coal seatlar pmpty_s natun civ_war polity anarchy nxtpa_el us_aid sunus gdpgrowt populati lagpcgdp imfstatu WoverS Wgrow, dist(w) cluster(code) 
use "c:\Data Sets\Africa\africa_4.dta", clear
drop pcoup
predict pcoup, hazard
replace IMFpcoup = imfstatu*pcoup

save "c:\Data Sets\Africa\africa_4.dta", replace

use "c:\Data Sets\Africa\africa_5.dta", clear
stset coupcount, failure(atcoup) id(coupid)
bsample
streg miltogdp currenta  intrimgv subsh num_coal seatlar pmpty_s natun civ_war polity anarchy nxtpa_el us_aid sunus gdpgrowt populati lagpcgdp imfstatu WoverS Wgrow, dist(w) cluster(code) 
use "c:\Data Sets\Africa\africa_5.dta", clear
drop pcoup
predict pcoup, hazard
replace IMFpcoup = imfstatu*pcoup

save "c:\Data Sets\Africa\africa_5.dta", replace

use "c:\Data Sets\Africa\africa_6.dta", clear
stset coupcount, failure(atcoup) id(coupid)
bsample
streg miltogdp currenta  intrimgv subsh num_coal seatlar pmpty_s natun civ_war polity anarchy nxtpa_el us_aid sunus gdpgrowt populati lagpcgdp imfstatu WoverS Wgrow, dist(w) cluster(code) 
use "c:\Data Sets\Africa\africa_6.dta", clear
drop pcoup
predict pcoup, hazard
replace IMFpcoup = imfstatu*pcoup

save "c:\Data Sets\Africa\africa_6.dta", replace

use "c:\Data Sets\Africa\africa_7.dta", clear
stset coupcount, failure(atcoup) id(coupid)
bsample
streg miltogdp currenta  intrimgv subsh num_coal seatlar pmpty_s natun civ_war polity anarchy nxtpa_el us_aid sunus gdpgrowt populati lagpcgdp imfstatu WoverS Wgrow, dist(w) cluster(code) 
use "c:\Data Sets\Africa\africa_7.dta", clear
drop pcoup
predict pcoup, hazard
replace IMFpcoup = imfstatu*pcoup

save "c:\Data Sets\Africa\africa_7.dta", replace

use "c:\Data Sets\Africa\africa_8.dta", clear
stset coupcount, failure(atcoup) id(coupid)
bsample
streg miltogdp currenta  intrimgv subsh num_coal seatlar pmpty_s natun civ_war polity anarchy nxtpa_el us_aid sunus gdpgrowt populati lagpcgdp imfstatu WoverS Wgrow, dist(w) cluster(code) 
use "c:\Data Sets\Africa\africa_8.dta", clear
drop pcoup
predict pcoup, hazard
replace IMFpcoup = imfstatu*pcoup

save "c:\Data Sets\Africa\africa_8.dta", replace

use "c:\Data Sets\Africa\africa_9.dta", clear
stset coupcount, failure(atcoup) id(coupid)
bsample
streg miltogdp currenta  intrimgv subsh num_coal seatlar pmpty_s natun civ_war polity anarchy nxtpa_el us_aid sunus gdpgrowt populati lagpcgdp imfstatu WoverS Wgrow, dist(w) cluster(code) 
use "c:\Data Sets\Africa\africa_9.dta", clear
drop pcoup
predict pcoup, hazard
replace IMFpcoup = imfstatu*pcoup

save "c:\Data Sets\Africa\africa_9.dta", replace

use "c:\Data Sets\Africa\africa_10.dta", clear
stset coupcount, failure(atcoup) id(coupid)
bsample
streg miltogdp currenta  intrimgv subsh num_coal seatlar pmpty_s natun civ_war polity anarchy nxtpa_el us_aid sunus gdpgrowt populati lagpcgdp imfstatu WoverS Wgrow, dist(w) cluster(code) 
use "c:\Data Sets\Africa\africa_10.dta", clear
drop pcoup
predict pcoup, hazard
replace IMFpcoup = imfstatu*pcoup

save "c:\Data Sets\Africa\africa_10.dta", replace

